import os

sources = ['src/popen.cpp']

env = Environment()
env['CPPPATH'] = ['include/popen++']
env['LIBS'] = []

if os.name == 'nt':
    sources += ['src/win32/process_traits_win32.cpp']
    
    env['CPPFLAGS'] = "/EHs"
    env['CPPPATH'] += ['C:\\work\\distrib\\boost_1_33_1']

    env.StaticLibrary("popen++-s", sources)
else:
    sources += ['src/posix/process_traits_posix.cpp']
    
    lib =env.SharedLibrary("popen++", sources)
    env.StaticLibrary("popen++-s", sources)
    env.Install("/usr/local/include/", "include/popen++")
    env.Install("/usr/local/lib/", lib)
    env.Alias("install", ["/usr/lib", "/usr/include"])
    
    env['LIBS'] += ['boost_iostreams', 'boost_unit_test_framework-s']
    env['LIBPATH'] = ['.']


testenv = Environment()
testenv['CPPPATH'] = ['include']
testenv['LIBPATH'] = ['.']
testenv['LIBS'] = ['boost_iostreams', 'boost_unit_test_framework-s', 'popen++-s']
testenv.Program("test-popen++", "test/test_popen++.cpp")

